<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>角色管理</title>
    <link href="../../component/pear/css/pear.css" rel="stylesheet"/>
</head>
<body class="pear-container">
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="">

<!--            <div class="layui-form-item">-->
<!--                -->
<!--                <div class="layui-form-item layui-inline">-->


<!--                    <label class="layui-form-label">id</label>-->
<!--                    <div class="layui-input-inline">-->
<!--                        <input type="text" name="id" placeholder="" class="layui-input">-->
<!--                    </div>-->
<!--                </div>-->
<!--                <div class="layui-form-item layui-inline">-->
<!--                    <label class="layui-form-label">名称</label>-->
<!--                    <div class="layui-input-inline">-->
<!--                        <input type="text" name="name" placeholder="" class="layui-input">-->
<!--                    </div>-->
<!--                </div>-->
<!--                <div class="layui-form-item layui-inline">-->
<!--                    <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="role-query">-->
<!--                        <i class="layui-icon layui-icon-search"></i>-->
<!--                        查询-->
<!--                    </button>-->
<!--                    <button type="reset" class="pear-btn pear-btn-md">-->
<!--                        <i class="layui-icon layui-icon-refresh"></i>-->
<!--                        重置-->
<!--                    </button>-->
<!--                </div>-->
<!--            </div>-->

        </form>
    </div>
</div>
<div class="layui-card">
    <div class="layui-card-body">
        <table id="role-table" lay-filter="role-table"></table>
    </div>
</div>

<script type="text/html" id="role-toolbar">
    <button class="pear-btn pear-btn-primary pear-btn-md" onclick="function f() {
        alert('不可更改，有问题请联系开发者')
    } f()">
        <i class="layui-icon layui-icon-add-1"></i>
        新增
    </button>
    <button class="pear-btn pear-btn-danger pear-btn-md" onclick="function f() {
        alert('不可更改，有问题请联系开发者')
    } f()">
        <i class="layui-icon layui-icon-delete"></i>
        删除
    </button>
</script>

<script src="../../component/layui/layui.js"></script>
<script src="../../component/pear/pear.js"></script>
<script>
    layui.use(['table', 'form', 'jquery'], function () {
        let table = layui.table;
        let form = layui.form;
        let $ = layui.jquery;

        let MODULE_PATH = "operate/";

        let cols = [
            [
                {type: 'checkbox'},
                {title: 'id', field: 'id', align: 'center', width: 100},
                {title: '名称', field: 'name', align: 'center'},
                {title: '描述', field: 'description', align: 'center'}
            ]
        ]

        table.render({
            elem: '#role-table',
            url: '../../admin/data/role.json',
            page: true,
            cols: cols,
            skin: 'line',
            toolbar: '#role-toolbar',
            defaultToolbar: [{
                title: '刷新',
                layEvent: 'refresh',
                icon: 'layui-icon-refresh',
            }, 'filter', 'print', 'exports']
        });

        form.on('submit(role-query)', function (data) {
            table.reload('role-table', {where: data.field})
            return false;
        });

        window.refresh = function () {
            table.reload('role-table');
        }
    })
</script>
</body>
</html>
